{% extends "base.html" %}
{# Page des classements #}

{% block title %}{{ pageTitle}}{% endblock %}

{% block content %}
	<!-- test: <a href="?begin=1&pid=33&ice=0&penta=1&stp=0&country=13">lien test params</a> -->
	
	    <form action="" method="GET">
			<label>Penta</label>
			<input type="hidden" name="penta" value="off"/>
			<input type="checkbox" name="penta" value="on" {%if pentaSelected == 'on' %}checked="true"{% endif %} onchange="submit()" />
	 
			<label>Track type</label>
			<select name="type" onchange="submit()">        		
				{% for type in types %}
					{%if type.id == typeSelected %}                
						<option selected="selected" value="{{type.id}}">{{type.name}}</option>
					{% else %}
						<option value="{{type.id}}">{{type.name}}</option>
					{% endif %}
				{% endfor %}
			</select>
			<label>Mode</label>
			<select name="mode" onchange="submit()">
				{% for mode in modes %}
					{%if mode.id == modeSelected %}
						<option selected="selected" value="{{mode.id}}">{{mode.mode}}</option>
					{% else %}
						<option value="{{mode.id}}">{{mode.mode}}</option>
					{% endif %}
				{% endfor %}
			</select>
			
			{% if countrySelected.getName() %}
				<input type="hidden" name="country" value="{{countrySelected.getId()}}" />
			{% endif %}
		</form>
	
	
	
	
	
    {% if records %}
    <table>
    	<!-- <th>Rank</th> -->
    	<th>Track Name</th>
    	<th>Player</th>
    	<th>Time</th>
    	<!--<th>Track Mode</th>-->
    	<!--<th>Track Type</th>-->
    	<th>Character</th>
	
    	<!--<th>Penta</th>-->
		{% if modeSelected == 2 %}
    	<th>STP</th>
    	<th>Ice</th>
		{% endif %}
    	<th>Version</th>
    	<th>Proof</th>
    	<th>Date</th>
    	<!--<th>State</th>-->

    {% for record in records %}
    	<tr>
			<td>{{ record.getTrackName() }}</td>
			
			<td><a href="profile.php?pid={{ record.getPlayer().getId() }}">{{ record.getPlayer().getNickname() }}</a> ({{ record.getPlayer().getCountry().getName() }})</td>
			
			<!--<td>{{ record.getTrackMode().name }}</td>-->
			<!--<td>{{ record.getTrackType().name }}</td>-->
			
			<td>{{ record }}</td>
			
			<td><img width="30px" src="{{ record.getCharacter().thumb }}" title="{{ record.getCharacter().name }}" /></td>	
		
			<!--<td>{{ record.penta }}</td>-->
			{% if modeSelected == 2 %}
			<td>{% if record.stp %}[YES]{% else %}[NO]{% endif %}</td>
			<td>{% if record.ice %}[YES]{% else %}[NO]{% endif %}</td>
			{% endif %}
			
			<td>{{ record.getVersion().name }}</td>
			<!--<td>{{ record.state }}</td>-->	
		
			<td>
				<!--<iframe title="YouTube video player" width="240" height="195" src="{{ record.getProof().url }}" frameborder="0" allowfullscreen></iframe>-->
				{% if record.getProof() %}
					<a href="{{ record.getProof().url }}">[OK]</a>
				{% endif %}
			</td>
			
			<td>{{ record.date }}</td>
        </tr>
	{% endfor %}
	</table>
    {% else %}
    	No records
    {% endif %}

{% endblock content %}